#!/bin/bash

if [ -n "$1" ] ; then
    data_date=$1
else
  data_date=`date -d '-1 day' +%F`
fi
ods_user_action_log="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_logs/${data_date}'
    OVERWRITE INTO TABLE jtp_gd07_warehouse.ods_tb_user_action_log PARTITION (dt = '${data_date}');
"
/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${ods_user_action_log}"